package com.baizhi.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.stereotype.Component;

@Component
public class SecondAspect {

    //前置通知
    public void before(){
        System.out.println("Second前置通知>>>>>>>>>");
    }

    //环绕通知
    public Object around(ProceedingJoinPoint jp) throws Throwable {
        try{
            //System.out.println("Second环绕通知之前>>>>>>>>>");
            System.out.println("开启权限验证");
            Object proceed = jp.proceed();
           // System.out.println("Second环绕通知之后>>>>>>>>>");
            System.out.println("执行成功");
            return proceed;
        }catch(Exception e){
           // e.printStackTrace();
            System.out.println("抛出了异常--------------------");
        }
        return null;


    }

    //后置通知
    public void afterReturning(){
        System.out.println("Second后置通知>>>>>>>>>");
    }

    //异常通知
    public void afterThrow(){
        System.out.println("Second异常通知>>>>>>>>>");
    }

    //最终通知
    public void after(){
        System.out.println("Second最终通知>>>>>>>>>");
    }
}
